package com.crm.service.impl;

import com.crm.base.BaseServiceImpl;
import com.crm.mapper.CustomerMapper;
import com.crm.domain.entity.Customer;
import com.crm.service.CustomerService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 客户业务层实现类
 */

@Service
public class CustomerServiceImpl extends BaseServiceImpl<CustomerMapper, Customer> implements CustomerService {

    @Override
    public String proc1() {
        Map<String, Object> mp = new HashMap<>();
        mp.put("str", null);
        baseMapper.proc1(mp);
        return mp.get("str").toString();
    }

    @Override
    public Boolean add(Customer customer) {
        // 设置客户编号
        customer.setCustomerNo(proc1());
        return super.add(customer);
    }

    @Override
    public List<Map<String, Object>> findByCustomer() {
        return baseMapper.findByCustomer();
    }

    @Override
    public Integer userCount() {
        return baseMapper.userCount();
    }

    @Override
    public Integer customerCount() {
        return baseMapper.customerCount();
    }

    @Override
    public Integer devCount() {
        return baseMapper.devCount();
    }

    @Override
    public Integer lossCount() {
        return baseMapper.lossCount();
    }
}
